<?php
include_once('ClsSebent/config.php');
if("$rem_img"=="y" && $_SESSION['SITE_ID'] != ""){
		$sql="UPDATE cpanel_skin SET  cpnl_logo=''";
		//echo $sql;
		mysql_query($sql);		
		header("Location: cpanel_skin.php?site_id=".$_SESSION['SITE_ID']);
	}
	
if("$rem_hdr_img"=="y" && $_SESSION['SITE_ID'] != ""){
		$sql="UPDATE cpanel_skin SET  cpnl_hdr_image=''";
		//echo $sql;
		mysql_query($sql);		
		header("Location: cpanel_skin.php?site_id=".$_SESSION['SITE_ID']);
	}
	
include_once('king_head.php');

if($action=="Save" && $_SESSION['SITE_ID'] != "")
{ 
$pg_bg_clr=str_replace("#","",$pg_bg_clr);
$pg_bdr_1=str_replace("#","",$pg_bdr_1);
$pg_bdr_2=str_replace("#","",$pg_bdr_2);
$pg_bdr_3=str_replace("#","",$pg_bdr_3);
$pg_txt_clr=str_replace("#","",$pg_txt_clr);
$tbl_txt_clr=str_replace("#","",$tbl_txt_clr);
$div_line=str_replace("#","",$div_line);
$lnk_txt=str_replace("#","",$lnk_txt);
$lnk_vis=str_replace("#","",$lnk_vis);
$lnk_roll=str_replace("#","",$lnk_roll);

$Iqry="UPDATE cpanel_skin SET pg_bg_clr='$pg_bg_clr', pg_bdr_1='$pg_bdr_1', pg_bdr_2='$pg_bdr_2', pg_bdr_3='$pg_bdr_3', pg_txt_clr='$pg_txt_clr', tbl_txt_clr='$tbl_txt_clr', div_line='$div_line', lnk_txt='$lnk_txt', lnk_vis='$lnk_vis', lnk_roll='$lnk_roll'";

if (isset($cpnl_logo) && $cpnl_logo != "") {
$cpnl_logo_name=$_FILES['cpnl_logo']['name'];
//echo "Rakesh" . $cpnl_logo_name ."Rao"; //echo "photos/header/".$cpnl_logo_name;} 
			if(!copy($cpnl_logo,"./photos/header/".$cpnl_logo_name)){ echo "coping error!"; exit;}
			$Iqry=$Iqry . ", cpnl_logo='$cpnl_logo_name'";
		}
		
if (isset($cpnl_hdr_image) && $cpnl_hdr_image != "") {
$cpnl_hdr_image_name=$_FILES['cpnl_hdr_image']['name'];
			if(!copy($cpnl_hdr_image,"./photos/header/".$cpnl_hdr_image_name)){ echo "coping error!"; exit;}
			$Iqry=$Iqry . ", cpnl_hdr_image='$cpnl_hdr_image_name'";
		}

//echo $Iqry;
mysql_query($Iqry);?>
<script>location='cpanel_skin.php?site_id=<?php echo $_SESSION['SITE_ID'];?>&action=stop';</script>
<?php
}
$Sqry="SELECT * from cpanel_skin";
$rs=mysql_query($Sqry);
if($row=mysql_fetch_array($rs))
{
$cpnl_logo=$row['cpnl_logo'];
$cpnl_hdr_image=$row['cpnl_hdr_image'];
$pg_bg_clr=$row['pg_bg_clr'];
$pg_bdr_1=$row['pg_bdr_1'];
$pg_bdr_2=$row['pg_bdr_2'];
$pg_bdr_3=$row['pg_bdr_3'];
$pg_txt_clr=$row['pg_txt_clr'];
$tbl_txt_clr=$row['tbl_txt_clr'];
$div_line=$row['div_line'];
$lnk_txt=$row['lnk_txt'];
$lnk_vis=$row['lnk_vis'];
$lnk_roll=$row['lnk_roll'];
}
?>
<form name="frm" method="post" enctype="multipart/form-data" action="cpanel_skin.php?site_id=<?php echo $_SESSION['SITE_ID'];?>">
  <div align="center">
    <input type="hidden" name="site_id" value="<?php echo $_SESSION['SITE_ID'];?>" />
    <font color="#<?php echo $pg_txt_clr;?>" size="4"><strong>Admin Panel Skin Settings </strong></font><br />
    </p>
  </div>
  <TABLE width="100%" align="center">
    <tr>
      <td colspan="2"></td>
    </tr>
    <tr>
      <td>Control Panel Logo</td>
      <td><input type="file" name="cpnl_logo" size=20>      
	<?php if($cpnl_logo !=""){ ?><a href="./photos/header/<?php echo $cpnl_logo?>" target="_n1">View current Logo </a>&nbsp;&nbsp;<a href='cpanel_skin.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>&rem_img=y'>Remove Logo </a><?php } else echo "(No existing image)"; ?></td>
    </tr>
    <tr>
      <td>Control Panel Header Image</td>
      <td><input type="file" name="cpnl_hdr_image" size=20>     
	<?php if($cpnl_hdr_image !=""){ ?><a href="./photos/header/<?php echo $cpnl_hdr_image; ?>" target="_n1">View current header-image</a>&nbsp;&nbsp;<a href='cpanel_skin.php?site_id=<?php echo $_SESSION['SITE_ID']; ?>&rem_hdr_img=y'>Remove Image</a><?php } else echo "(No existing image)"; ?></td>
    </tr>
    <tr>
      <td width="208">Page background color</td>
      <td><input type=text name=pg_bg_clr id=pg_bg_clr value="<?php echo $pg_bg_clr;?>" size="20">
      <?php pk_color('pg_bg_clr',1);?></td>
    </tr>
    <tr>
      <td>Page border color(main)</td>
      <td><input type=text name=pg_bdr_1 id=pg_bdr_1 value="<?php echo $pg_bdr_1;?>" size="20" /><?php pk_color('pg_bdr_1',2);?></td>
    </tr>
    <tr>
      <td>Page border color(header)</td>
      <td><input type=text name=pg_bdr_2 id=pg_bdr_2 value="<?php echo $pg_bdr_2;?>" size="20" /><?php pk_color('pg_bdr_2',3);?></td>
    </tr>
    <tr>
      <td>Page border color(control panel)</td>
      <td><input type=text name=pg_bdr_3 id=pg_bdr_3 value="<?php echo $pg_bdr_3;?>" size="20" /><?php pk_color('pg_bdr_3',4);?></td>
    </tr>
    <tr>
      <td>Page text color</td>
      <td><input type=text name=pg_txt_clr id=pg_txt_clr value="<?php echo $pg_txt_clr;?>" size="20"><?php pk_color('pg_txt_clr',5);?></td>
    </tr>
    <tr>
      <td>Page table text color</td>
      <td><input type=text name=tbl_txt_clr id=tbl_txt_clr value="<?php echo $tbl_txt_clr;?>" size="20"><?php pk_color('tbl_txt_clr',6);?></td>
    </tr>
    <tr>
      <td>Menu Divider Line</td>
      <td><input type=text name=div_line id=div_line value="<?php echo $div_line;?>" size="20"><?php pk_color('div_line',7);?></td>
    </tr>
    <tr>
      <td>Link text color</td>
      <td><input type=text name=lnk_txt id=lnk_txt value="<?php echo $lnk_txt;?>" size="20"><?php pk_color('lnk_txt',8);?></td>
    </tr>
    <tr>
      <td>Link visited color</td>
      <td><input type=text name=lnk_vis id=lnk_vis value="<?php echo $lnk_vis;?>" size="20"><?php pk_color('lnk_vis',9);?></td>
    </tr>
    <tr>
      <td>Link rollover color</td>
      <td><input type=text name=lnk_roll id=lnk_roll value="<?php echo $lnk_roll;?>" size="20"><?php pk_color('lnk_roll',10);?></td>
    </tr>
    <tr>
      <td colspan=2 align=center><input type="submit" name="action" value="Save" >
          <!--<input type=submit name=action value='Color Pellette'>--></TD>
    </TR>
  </TABLE>
</form>
<?php
include_once('king_foot.php');
?>